feat(fs): add sys_dup3#755
Merged
Conversation
Contributor
|
感谢您的pull request,欢迎加入!🎉 DragonOS社区很兴奋地期待审核您的更改,您将在接下来的两周内收到 @fslongjin (or someone else) 的回复。💬😊 Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
fslongjin
requested changes
Apr 22, 2024
| } | ||
|
|
||
| #[cfg(target_arch = "x86_64")] | ||
| SYS_DUP3 => { |
kernel/src/filesystem/vfs/syscall.rs
Outdated
|
|
||
| pub fn dup3(oldfd: i32, newfd: i32, flags: u32) -> Result<usize, SystemError> { | ||
| let flags: FileMode = FileMode::from_bits(flags).ok_or(SystemError::EINVAL)?; | ||
| if flags != FileMode::O_CLOEXEC { |
Member
There was a problem hiding this comment.
这里的实现逻辑不正确。
参考dup3的含义:
https://man7.org/linux/man-pages/man2/dup.2.html
dup3()
dup3() is the same as dup2(), except that:
• The caller can force the close-on-exec flag to be set for the
new file descriptor by specifying O_CLOEXEC in flags. See the
description of the same flag in open(2) for reasons why this
may be useful.
• If oldfd equals newfd, then dup3() fails with the error
EINVAL.
Member
Author
|
@dragonosbot ready |
Member
|
提交代码的时候需要先make fmt进行格式化,并修复clippy报出的error哈。我刚帮你修了。 |
fslongjin
approved these changes
Apr 23, 2024
Closed
BrahmaMantra
pushed a commit
to BrahmaMantra/DragonOS
that referenced
this pull request
Dec 9, 2024
* feat(fs): add sys_dup3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
实现dup3系统调用并给出测试用例。